; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs < %s -mcpu=pwr9 -mtriple=powerpc64le-ibm-linux| FileCheck %s

; This file verifies that for a given floating point load / store pair,
; if the load value isn't used by any other operations,
; then consider transforming the pair to integer load / store operations

@a1 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a2 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a3 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a4 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a5 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a6 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a7 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a8 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a9 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a10 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a11 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a12 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a13 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a14 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a15 = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@a16 = dso_local local_unnamed_addr global ppc_fp128 0xM00000000000000000000000000000000, align 16
@a17 = dso_local local_unnamed_addr global fp128 0xL00000000000000000000000000000000, align 16

; Because this test function is trying to pass float argument by stack,
; so the fpr is only used to load/store float argument
define dso_local signext i32 @test() nounwind {
; CHECK-LABEL: test:
; CHECK:       # %bb.0:
; CHECK-NEXT:    mflr 0
; CHECK-NEXT:    stdu 1, -192(1)
; CHECK-NEXT:    addis 3, 2, a1@toc@ha
; CHECK-NEXT:    std 0, 208(1)
; CHECK-NEXT:    addis 5, 2, a16@toc@ha
; CHECK-NEXT:    addis 6, 2, a17@toc@ha
; CHECK-NEXT:    addis 4, 2, a15@toc@ha
; CHECK-NEXT:    lfd 1, a1@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a2@toc@ha
; CHECK-NEXT:    addi 5, 5, a16@toc@l
; CHECK-NEXT:    addi 6, 6, a17@toc@l
; CHECK-NEXT:    ld 4, a15@toc@l(4)
; CHECK-NEXT:    lfd 2, a2@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a3@toc@ha
; CHECK-NEXT:    lxv 34, 0(6)
; CHECK-NEXT:    lxv 0, 0(5)
; CHECK-NEXT:    li 5, 152
; CHECK-NEXT:    lfd 3, a3@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a4@toc@ha
; CHECK-NEXT:    lfd 4, a4@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a5@toc@ha
; CHECK-NEXT:    lfd 5, a5@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a6@toc@ha
; CHECK-NEXT:    lfd 6, a6@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a7@toc@ha
; CHECK-NEXT:    lfd 7, a7@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a8@toc@ha
; CHECK-NEXT:    lfd 8, a8@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a9@toc@ha
; CHECK-NEXT:    lfd 9, a9@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a10@toc@ha
; CHECK-NEXT:    lfd 10, a10@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a11@toc@ha
; CHECK-NEXT:    lfd 11, a11@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a12@toc@ha
; CHECK-NEXT:    lfd 12, a12@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a13@toc@ha
; CHECK-NEXT:    lfd 13, a13@toc@l(3)
; CHECK-NEXT:    addis 3, 2, a14@toc@ha
; CHECK-NEXT:    ld 3, a14@toc@l(3)
; CHECK-NEXT:    stxvx 0, 1, 5
; CHECK-NEXT:    std 4, 144(1)
; CHECK-NEXT:    std 3, 136(1)
; CHECK-NEXT:    bl _Z3fooddddddddddddddd
; CHECK-NEXT:    nop
; CHECK-NEXT:    li 3, 0
; CHECK-NEXT:    addi 1, 1, 192
; CHECK-NEXT:    ld 0, 16(1)
; CHECK-NEXT:    mtlr 0
; CHECK-NEXT:    blr
%1 = load double, ptr @a1, align 8
%2 = load double, ptr @a2, align 8
%3 = load double, ptr @a3, align 8
%4 = load double, ptr @a4, align 8
%5 = load double, ptr @a5, align 8
%6 = load double, ptr @a6, align 8
%7 = load double, ptr @a7, align 8
%8 = load double, ptr @a8, align 8
%9 = load double, ptr @a9, align 8
%10 = load double, ptr @a10, align 8
%11 = load double, ptr @a11, align 8
%12 = load double, ptr @a12, align 8
%13 = load double, ptr @a13, align 8
%14 = load double, ptr @a14, align 8
%15 = load double, ptr @a15, align 8
%16 = load ppc_fp128, ptr @a16, align 16
%17 = load fp128, ptr @a17, align 16
tail call void @_Z3fooddddddddddddddd(double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, ppc_fp128 %16, fp128 %17)
ret i32 0
}

declare void @_Z3fooddddddddddddddd(double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, ppc_fp128, fp128)
